|
|
|
|
|
|
|
The Rotated3d class manages surfaces of revolution. It stores the points that make up the base curve much as the Extrusion3d class does. It has a CurvePoints array and an AddCurvePoint method that allows the program to add points to the base curve. |
|
|
|
|
|
|
|
|
Like the Extrusion3d class, the Rotated3d class displays its surface using a Polyline3d object. The Rotate method rotates the base curve around the Y axis and adds the resulting line segments to the Polyline3d object. You could easily make similar routines for rotating the curve around the X or Z axis. You could also create a more general routine that uses translations and rotations to rotate the curve around an arbitrary line. |
|
|
|
 |
|
|
|
|
Option Explicit
Private NumCurvePts As Integer
Private CurvePoints() As Point3D
Private ThePolyline As Polyline3d ' The display polyline.
' Add a point to the curve. Public Sub AddCurvePoint(ByVal X As Single, _
ByVal Y As Single, ByVal Z As Single)
NumCurvePts = NumCurvePts + 1
ReDim Preserve CurvePoints(1 To NumCurvePts)
With CurvePoints(NumCurvePts)
.coord(1) = X
.coord(2) = Y
.coord(3) = Z
.coord(4) = 1
End With
End Sub
' Create the display polyline by rotating around
' the Y axis. Public Sub Rotate()
Dim i As Integer
Dim R As Single
Dim theta As Single
Dim dtheta As Single
Dim T As Single
Dim X As Single
Dim Z As Single
Dim x1 As Single
Dim y1 As Single
Dim z1 As Single
Dim x2 As Single
Dim y2 As Single
Dim z2 As Single
Set ThePolyline = New Polyline3d |
|
|
|
|
|